package com.amgl.amupush.news;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.amgl.amupush.R;
import com.amgl.amupush.base.BaseActivity;
import com.amgl.amupush.utils.AmuUtils;

import timber.log.Timber;

public class NewsActivity extends BaseActivity implements NewsFragment.OnFragmentInteractionListener {

    NewsPresenter mNewsPresenter;
    NewsFragment mNewsFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news);
        if (mNewsFragment == null) {
            mNewsFragment = NewsFragment.newInstance("", "");
            AmuUtils.addFragmentToActivity(getSupportFragmentManager(), mNewsFragment, R.id.contentFrame);
        } else {
            Timber.d("fragment not null %s", mNewsFragment.isAdded());
        }

        mNewsPresenter = new NewsPresenter(mNewsFragment);
    }

    @Override
    public void onFragmentInteraction(Uri uri) {
        startTest();
    }

    private void startTest() {
        Intent intent = new Intent(this, TestActivity.class);
        startActivity(intent);
    }
}
